home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
PROGRAMR
/
LB09D.ZIP
/
SUMMARY.TXT
< prev
next >
Wrap
Text File
|
1992-12-03
|
52KB
|
1,759 lines
This file describes the many commands and functions of Liberty BASIC.
The format goes like this:
Command/Function Name and Syntax optional items in gray
Description:
a short, exact specification for the command/function
Usage:
an example of how to use the function command in a short
Liberty BASIC program fragment
Explore the included Liberty BASIC source files for more information.
See the section at the end of this file about commands for controlling
the spreadsheet, graphics, and text windows.
NOTE: This file is designed to be dumped to a printer with FF characters
to place each statement or function at the top of the next page.
For most, this is accomplished simply enough:
C:\LIBERTY>type summary.txt > lpt1:
or you could simply print this file from the Windows Notepad
ASC( n$ )
Description:
This function returns the ASCII value of the first character of string n$.
Usage:
print asc( "A" ) produces: 65
let name$ = "Tim"
firstLetter = asc(name$)
print firstLetter produces: 84
print asc( "" ) produces: 0
BEEP
Description:
This command simply rings the system bell, as in CTRL-G
Usage:
.
.
[loop]
input "Give me a number between 1 and 10?"; number
if number < 1 or number > 10 then beep : print "Out of range!" : goto [loop]
print "The square of "; number; " is "; number ^ 2
.
.
BUTTON #handle, label, return, corner, posx, posy
Description:
This statement lets you add buttons to windows that you open. The main
program window cannot have buttons added, but any window that you create
via the OPEN command can have as many buttons as you want. In this release
of Liberty BASIC, buttons cannot have graphic pictures on them, but only
text labels. This will be remedied in a future release.
Usage:
Before you actually OPEN the window, each button must be declared with a
BUTTON statement. Here is a brief description for each parameter as listed
above:
#handle - any valid file handle may be used. You must use the same handle
as will be used for the window that the button will belong to.
label - Type the label desired for the button here. Do not bound the word
with quotes, and do not use a string variable.
return - Again, use only one word and do not bound it with quotes or use a
string variable. If return is set to a valid branch label, then when
the button is pressed, execution will restart there (just as with
GOTO or GOSUB), but if return is not a valid branch label, then the
value of return is used as input to a specified variable (as in
input a$).
corner - UL, UR, LL, or LR specifies which corner of the window to anchor
the button to. For example, if LR is used, then the button will
appear in the lower right corner. UL = upper left, UR = upper
right, LL = lower left, and LR = lower right
posx, posy - These two parameters determine how to place the button relative to
the corner it has been anchored to. For example if corner is LR,
posx is 5, and posy is 5, then the button will be 5 pixels up and
left of the lower right corner. Another way to use posx & posy is
to use values less than one. For example, if corner is UL, posx
is .9, and posy is .9, then the button will be positioned 9/10th of
the distance of the window in both x and y from the upper left
corner (and thus appear to be anchored to the lower right corner).
BUTTON Continued
Here is a sample program:
' this button will be labeled Sample and will be located
' in the lower right corner. When it is pressed, program
' execution will transfer to [test]
button #graph, Sample, [test], LR, 5, 5
' this button will be labeled Example and will be located
' in the lower left corner. When it is pressed, the string
' "Example" will be returned.
button #graph, Example, Example, LL, 5, 5
' open a window for graphics
open "Button Sample" for graphics as #graph
' print a message in the window
print #graph, "\This is a test"
' get button input
[loop]
input b$
if b$ = "Example" then [example]
goto [loop]
' the Sample button has been pressed, ring the terminal bell
' and close the window
[test]
beep
close #graph
end
' The Example button has been pressed, close the window
' without ringing the bell
[example]
close #graph
end
CHR$( n )
Description:
Returns a one character long string, consisting of the character
represented on the ASCII table by the value n (0 - 255).
Usage:
' print each seperate word in text$ on its own line
text$ = "now is the time for all great men to rise"
for index = 1 to len(text$)
c$ = mid$(text$, index, 1)
' if c$ is a space, change it to a carraige return
if c$ = chr$(32) then c$ = chr$(13)
print c$ ;
next index Produces:
now
is
the
time
for
all
great
men
to
rise
CLOSE #handle
Description:
This command is used to close files and devices. This is the last step of
a file read and/or write, or to close graphic, spreadsheet, or other
windows when finished with them. If when execution of a program is
complete there are any files or devices left open, Liberty BASIC will
display a dialog informing you that it found it necessary to close the
opened files or devices. This is designed as an aid for you so that you
will be able to correct the problem. If on the other hand you choose to
terminate the program early (this is done by closing the program's main
window before the program finishes), then Liberty BASIC will close any open
files or devices without posting a notice to that effect.
Usage:
open "Graphic" for graphics as #gWindow ' open a graphics window
print #gWindow, "home" ' center the pen
print #gWindow, "down" ' put the pen down
for index = 1 to 100 ' loop 100 times
print #gWindow, "go "; index ' move the pen foreward
print #gWindow, "turn 63" ' turn 63 degrees
next index
input "Press 'Return'."; r$ ' this appears in main window
close #gWindow ' close graphic window
CLS
Description:
Clears the main program window of text and sets the cursor back at the
upper left hand corner. Useful for providing a break to seperate
different sections of a program functionally. Additionally, since the main
window doesn't actually discard past information on its own, the CLS
command can be used to reclaim memory from your program by forcing the main
window to dump old text.
Usage:
.
.
print "The total is: "; grandTotal
input "Press 'Return' to continue."; r$
cls
print "*** Enter Next Round of Figures ***"
.
.
CONFIRM string; responseVar
Description:
This statement opens a dialog box displaying the contents of string and
presenting two buttons marked 'Yes' and 'No'. When the selection is made,
the string "yes" is returned if 'Yes' is pressed, and the string "no" is
returned if 'No' is pressed. The result is placed in responseVar.
Usage:
[quit]
' bring up a confirmation box to be sure that
' the user want to quit
confirm "Are you sure you want to QUIT?"; answer$
if answer$ = "no" then [mainLoop]
end
COS( n )
Description:
Returns the cosine of the number n.
Usage:
.
.
for c = 1 to 45
print "The cosine of "; c; " is "; cos(c)
next c
.
.
Note:
See also SIN( ) and TAN( )
DATE$( )
Description:
Instead of adopting MBASIC's date$ variable, we decided to use a functi